/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bs.views;

import com.bs.beans.TipoLancamento;
import java.util.ArrayList;
import org.jdesktop.observablecollections.ObservableCollections;

/**
 *
 * @author Bone
 */
public class TipoLancamentoView extends javax.swing.JPanel {

    /**
     * Creates new form BancoDetalhe
     */
    public TipoLancamentoView() {
        initComponents();
        tipoLancamentoGridController.getParametros().add(descricaoPesquisa);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        entityManager = new com.bs.persistencia.EntityManager();
        tipoLancamentoGridController = new com.bs.controllers.TipoLancamentoGridController<com.bs.beans.TipoLancamento>();
        tipoLancamento = new com.bs.beans.TipoLancamento();
        list = ObservableCollections.observableList(new ArrayList<com.bs.beans.TipoLancamento>());
        tituloFormulario1 = new com.bs.extensoesSwing.TituloFormulario();
        jPanel1 = new javax.swing.JPanel();
        campoNumericoInteiro1 = new com.bs.extensoesSwing.CampoNumericoInteiro();
        jLabel1 = new javax.swing.JLabel();
        descricaoPesquisa = new com.bs.pesquisaView.PesquisaTexto();
        filtrarRegistroGridButton1 = new com.bs.extensoesSwing.FiltrarRegistroGridButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tipoLancamentoTable = new javax.swing.JTable();
        novoRegistroGridButton1 = new com.bs.extensoesSwing.NovoRegistroGridButton();
        excluirRegistroGridButton1 = new com.bs.extensoesSwing.ExcluirRegistroGridButton();
        alterarRegistroGridButton1 = new com.bs.extensoesSwing.AlterarRegistroGridButton();
        atualizarGridButton1 = new com.bs.extensoesSwing.AtualizarGridButton();
        jSeparator1 = new javax.swing.JSeparator();

        tipoLancamentoGridController.setClasse(tipoLancamento);
        tipoLancamentoGridController.setEntityManager(entityManager);
        tipoLancamentoGridController.setLimiteRegistros(30);
        tipoLancamentoGridController.setLista(list);

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, tipoLancamentoTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), tipoLancamentoGridController, org.jdesktop.beansbinding.BeanProperty.create("beanSelecionado"));
        binding.setSourceNullValue(null);
        binding.setSourceUnreadableValue(null);
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, tipoLancamentoTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.id}"), tipoLancamentoGridController, org.jdesktop.beansbinding.BeanProperty.create("idBeanSelecionado"));
        bindingGroup.addBinding(binding);

        setName("Tipo de lançamento"); // NOI18N

        tituloFormulario1.setTitulo("Tipo de lançamento");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Filtro"));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, tipoLancamentoGridController, org.jdesktop.beansbinding.ELProperty.create("${limiteRegistros}"), campoNumericoInteiro1, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceUnreadableValue(null);
        bindingGroup.addBinding(binding);

        jLabel1.setText("Limite de registros:");

        descricaoPesquisa.setCampo("descricao");
        descricaoPesquisa.setLegenda("Descrição:");

        filtrarRegistroGridButton1.setController(tipoLancamentoGridController);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(descricaoPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(filtrarRegistroGridButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(campoNumericoInteiro1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(210, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campoNumericoInteiro1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(descricaoPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(filtrarRegistroGridButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        tipoLancamentoTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list, tipoLancamentoTable);
        org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${descricao}"));
        columnBinding.setColumnName("Descricao");
        columnBinding.setColumnClass(String.class);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        jScrollPane1.setViewportView(tipoLancamentoTable);

        novoRegistroGridButton1.setController(tipoLancamentoGridController);

        excluirRegistroGridButton1.setController(tipoLancamentoGridController);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, tipoLancamentoTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), excluirRegistroGridButton1, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
        bindingGroup.addBinding(binding);

        alterarRegistroGridButton1.setController(tipoLancamentoGridController);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, tipoLancamentoTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement != null}"), alterarRegistroGridButton1, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
        bindingGroup.addBinding(binding);

        atualizarGridButton1.setController(tipoLancamentoGridController);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tituloFormulario1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane1)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(novoRegistroGridButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(alterarRegistroGridButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(excluirRegistroGridButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(atualizarGridButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
            .addComponent(jSeparator1)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(tituloFormulario1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(novoRegistroGridButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(excluirRegistroGridButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(alterarRegistroGridButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(atualizarGridButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        bindingGroup.bind();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private com.bs.extensoesSwing.AlterarRegistroGridButton alterarRegistroGridButton1;
    private com.bs.extensoesSwing.AtualizarGridButton atualizarGridButton1;
    private com.bs.extensoesSwing.CampoNumericoInteiro campoNumericoInteiro1;
    private com.bs.pesquisaView.PesquisaTexto descricaoPesquisa;
    private com.bs.persistencia.EntityManager entityManager;
    private com.bs.extensoesSwing.ExcluirRegistroGridButton excluirRegistroGridButton1;
    private com.bs.extensoesSwing.FiltrarRegistroGridButton filtrarRegistroGridButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private java.util.List<TipoLancamento> list;
    private com.bs.extensoesSwing.NovoRegistroGridButton novoRegistroGridButton1;
    private com.bs.beans.TipoLancamento tipoLancamento;
    private com.bs.controllers.TipoLancamentoGridController<com.bs.beans.TipoLancamento> tipoLancamentoGridController;
    private javax.swing.JTable tipoLancamentoTable;
    private com.bs.extensoesSwing.TituloFormulario tituloFormulario1;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
}
